var express = require('express');
var router = express.Router();

const db = require('../public/javascripts/db')

router.get('/', function(req, res, next) {
  let sql = "select * from staff";
  db(sql,null,(result) => {
    if (result.length >= 0) {
        res.json({
            code: 200,
            message: "查询成功",
            data: result,
        })
    } else {
        res.json({
            code: 500,
            message: "服务器错误"
        })
    }
  })
});

module.exports = router;
